package org.jeecg.modules.veterans.service.impl;

import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.system.util.SecurityUtil;
import org.jeecg.modules.veterans.entity.SysLikeRecord;
import org.jeecg.modules.veterans.mapper.SysLikeRecordMapper;
import org.jeecg.modules.veterans.service.ISysLikeRecordService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Date;

/**
 * @Description: 点赞记录表
 * @Author: jeecg-boot
 * @Date:   2022-07-06
 * @Version: V1.0
 */
@Service
public class SysLikeRecordServiceImpl extends ServiceImpl<SysLikeRecordMapper, SysLikeRecord> implements ISysLikeRecordService {
    @Override
    public boolean saveByOne(SysLikeRecord record){
        LoginUser loginUser = SecurityUtil.getLoginUser();
        record.setName(loginUser.getUsername());
        record.setUserId(loginUser.getId());
        record.setLiked("1");
        record.setLikedTime(new Date());
        return save(record);
    }
}
